package com.suep.data_analysis.repository;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.suep.data_analysis.model.DriveSet;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DriveSetRepository extends BaseMapper<DriveSet> {

    // 根据条件查询驱动盘套装
    @Select("select * from t_drive_set where ${ew.SQLSegment}")
    @Results({
            @Result(property = "setId", column = "set_id"),
            @Result(property = "setName", column = "set_name"),
            @Result(property = "imageUrl", column = "image_url"),
            @Result(property = "twoPieceEffect", column = "two_piece_effect"),
            @Result(property = "fourPieceEffect", column = "four_piece_effect"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "updateTime", column = "update_time")
    })
    List<DriveSet> selectDriveSet(@Param("ew") Wrapper<DriveSet> queryWrapper);

    // 查询所有驱动盘套装
    @Select("select * from t_drive_set")
    @Results({
            @Result(property = "setId", column = "set_id"),
            @Result(property = "setName", column = "set_name"),
            @Result(property = "imageUrl", column = "image_url"),
            @Result(property = "twoPieceEffect", column = "two_piece_effect"),
            @Result(property = "fourPieceEffect", column = "four_piece_effect"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "updateTime", column = "update_time")
    })
    List<DriveSet> selectAllDriveSets();
}